<?php
require_once("../../inc/global.php");
require_once("function.php");
adminislogin();
//$html->includetop();
$MenuID=$_GET["MenuID"];
if(empty($MenuID))
{
	YKT_error('参数不正确',$_SERVER['HTTP_REFERER']);
}
if(!empty($_POST["Submit"]))
{
	if(strtolower($_SERVER['REQUEST_METHOD'])=="post"){
		$FieldCount=$_POST["FieldCount"];
		$formconfig='';
		for($j=0;$j<$FieldCount;$j++)
		{
			
			$post_Name=isset($_POST["Name_".$j])?$_POST["Name_".$j]:"";
			$post_Input=isset($_POST["Input_".$j])?$_POST["Input_".$j]:"";
			$post_class=isset($_POST["class".$j])?$_POST["class".$j]:"";
			$post_Mark=isset($_POST["Mark_".$j])?$_POST["Mark_".$j]:"";
			$post_Show=isset($_POST["Show_".$j])?$_POST["Show_".$j]:"";
			$post_Check=isset($_POST["Check_".$j])?$_POST["Check_".$j]:"";
			$post_Defaultvalue=isset($_POST["Defaultvalue_".$j])?$_POST["Defaultvalue_".$j]:"";
			$formconfig.=$post_Name."|".$post_Input."|".$post_class."|".$post_Mark."|".$post_Show."|".$post_Check."|".$post_Defaultvalue;
			
			if($j!=($FieldCount-1)){
				$formconfig.=",";
			}
		}
		//显示的列表字段
		
		//字段列号/宽度/对齐方式
		$FieldList=$_POST["FieldList"];
		//配置权限   添加|修改|删除|批量删除|审核|翻页
		$Fieldquanxian='';
		for($j=1;$j<=6;$j++){
			$Fieldquanxian.=isset($_POST["checkbox{$j}"])?$_POST["checkbox{$j}"]:"";
			if($j<6){
				$Fieldquanxian.="|";
			}
		}
		//每页显示的记录条数
		$FieldPageSize=$_POST["PageSize"];
		if(empty($FieldPageSize)){  //如果没有设置默认为10
			$FieldPageSize=10;
		}
		//优先显示的详细字段
		$appear_firstconfig=$_POST["myconfig"];
		//前台屏蔽字段
		$Outappear_firstconfig=$_POST["Outmyconfig"];
		//搜索字段 
		$mySearchConfig=$_POST["mySearch"];
		//分级允许级数  这个只针对分类系统
		$myClassLev=$_POST["myClassLev"];
		if(empty($myClassLev)){
			$myClassLev=-1;
		}
		//在各页面显示的标题 
		$InfoTitle=$_POST["InfoTitle"];
		//在栏目中是否显示
		$MenuShow=$_POST["MenuShow"];
		
		$UPDateFieldlistConfig="{$FieldList},{$Fieldquanxian},{$FieldPageSize},{$appear_firstconfig},{$Outappear_firstconfig},{$mySearchConfig},{$myClassLev},{$InfoTitle}";
		if(!$db->query("update menusys Set menusys4='{$formconfig}',menusys5='{$UPDateFieldlistConfig}',menusys9={$MenuShow} where menusys0={$MenuID}"))
		{
			YKT_error('保存失败！！',$_SERVER['HTTP_REFERER']);
		}
	}
}

$tablename=$System->GetTableName($MenuID); //获取表名
$result=$db->query("Select * From {$tablename} limit 1");
$fieldscount=$db->getfieldscount($result);
$getfromconfig=$System->GetMenuSysFormConfig($MenuID);  //返回配置表单
$getfromconfigarr=explode(",",$getfromconfig);
$getfromconfigliststring=$System->GetMenuSysFromListConfig($MenuID);  //返回配置列表的信息
if(is_null($getfromconfigliststring)||empty($getfromconfigliststring)){
	$getfromconfigliststring=",|||||,10,,,,-1,";  //如果没有配置，则设定个默认值;
}
$getfromconfigliststringarr=explode(",",$getfromconfigliststring);
$getfromconfigmenushow=$System->GetMenuSysField($MenuID,9);  //返回栏目显示/隐藏开关
if(!empty($_POST["Submit"]))
{
	if(is_array($getfromconfigarr)){
		
		$Config_ShowFrom_List=$System->GetMenuSysField($MenuID,5);
		$Config_ShowFrom_Listarr=explode(",",$Config_ShowFrom_List);
		$Config_ShowFrom=$Config_ShowFrom_Listarr[3];
		
		
		
		//echo $Config_ShowFrom;
		
		//$getfromconfigarr=YKT_Config_FromSort($getfromconfigarr,$Config_ShowFrom);
		
		//生成模版文件
		 $FolderPath="../".$tablename."";
		if(!file_exists($FolderPath)){                        //判断文件夹是否存在
		  mkdir($FolderPath,0777);
		  @chmod($FolderPath,0777);
		}
		
		$writefilepath=$FolderPath."/".$MenuID.".tpl";
		$TemplateString=$html->includetop();
		$TemplateString.="\n<script type=\"text/javascript\" src=\"js.js\"></script>\n<form id=\"MyFrom_".$MenuID."\" name=\"MyFrom_".$MenuID."\" enctype=\"multipart/form-data\" method=\"post\" action=\"{ykt:Save_url}\">\n<input name=\"gotourl\" id=\"gotourl\" type=\"hidden\" value=\"{ykt:gotourl}\" /><table cellpadding=\"0\" align=\"center\" width=\"95%\" cellspacing=\"0\" border=\"0\">\n";
		
		$getfromconfigarr_count=count($getfromconfigarr);

		
		$TemplateStringlist=array();
		$TemplateStringlist_temp=array();
		for($f_j=0;$f_j<$getfromconfigarr_count;$f_j++){
			$TemplateString_temp=$From->ShowConfigFrom($getfromconfigarr[$f_j],"FileName_".$f_j,"{ykt:FileName_".$f_j."}",$MenuID);
			if($TemplateString_temp!=null){
				$TemplateStringlist[$f_j]=$TemplateString_temp;
			}
			//$TemplateString.=$From->ShowConfigFrom($getfromconfigarr[$f_j],"FileName_".$f_j,"{ykt:FileName_".$f_j."}")
		}
		
		$TemplateStringlist_temp_arr=explode('|',$getfromconfigliststringarr[3]);
		for($ttc=0;$ttc<count($TemplateStringlist_temp_arr);$ttc++){
			if(isset($TemplateStringlist[$TemplateStringlist_temp_arr[$ttc]])){
				array_push($TemplateStringlist_temp,$TemplateStringlist[$TemplateStringlist_temp_arr[$ttc]]);
				unset($TemplateStringlist[$TemplateStringlist_temp_arr[$ttc]]);
			}
		}
		
		$Templatehtmllistarr=array_merge($TemplateStringlist_temp,$TemplateStringlist);
		
		
		$Templatehtmllistarr_count=count($Templatehtmllistarr);
		for($tll=0;$tll<$Templatehtmllistarr_count;$tll++){
			$TemplateString.=$Templatehtmllistarr[$tll];
		}
		
		
		$TemplateString.="\n<tr><td align=\"center\" height=\"30\" colspan=\"2\"><span id=\"pilianadd\" style=\"display:none\">添加<input name=\"SuperNum\" type=\"text\" id=\"SuperNum\" value=\"1\" size=\"4\" maxlength=\"2\">条</span><input name=\"submit\" onclick=\"return CheckFrom()\" type=\"submit\" value=\" 保 存 \" />&nbsp;&nbsp;<input type=\"button\" value=\" 取 消 \" onclick=\"javascript:window.history.go(-1)\" /></td></tr></table>\n</form>\n";
		
		
		$TemplateString.="<script type=\"text/javascript\">function CheckFrom(){\n";
			for($f_i=0;$f_i<count($getfromconfigarr);$f_i++){
			$yz_arr=explode("|",$getfromconfigarr[$f_i]);
			if(intval($yz_arr[4])==0){
				$yzType=$yz_arr[1];
				$yz=explode("/",$yz_arr[5]);
				switch ($yzType) {
					case 1:

						if(count($yz)==3){
							
						$TemplateString.= "document.getElementById(\"FileName_{$f_i}_Msg\").innerHTML={$yz[0]}(document.getElementsByName(\"FileName_{$f_i}\")[0].value,{$yz[1]},{$yz[2]},\"<font color='red'>{$yz_arr[3]}</font>\");\n";
						}else{
						$TemplateString.= "document.getElementById(\"FileName_{$f_i}_Msg\").innerHTML=CharLen(document.getElementsByName(\"FileName_{$f_i}\")[0].value,0,100,\"<font color='red'>{$yz_arr[3]}</font>\");\n";
						}
						$TemplateString.= "if(document.getElementById(\"FileName_{$f_i}_Msg\").innerHTML.length>0){
					document.getElementsByName(\"FileName_{$f_i}\")[0].select();
					return false;
					}\n";
						break;
					case 5:
						if(count($yz)==3){
						$TemplateString.= "document.getElementById(\"FileName_{$f_i}_Msg\").innerHTML={$yz[0]}(document.getElementsByName(\"FileName_{$f_i}\")[0].value,{$yz[1]},{$yz[2]},\"<font color='red'>{$yz_arr[3]}</font>\");\n";
						}else{
						$TemplateString.= "document.getElementById(\"FileName_{$f_i}_Msg\").innerHTML=CharLen(document.getElementsByName(\"FileName_{$f_i}\")[0].value,0,500,\"<font color='red'>{$yz_arr[3]}</font>\");\n";
						}
						$TemplateString.= "if(document.getElementById(\"FileName_{$f_i}_Msg\").innerHTML.length>0){
					document.getElementsByName(\"FileName_{$f_i}\")[0].select();
					return false;
					}\n";
						break;
					case 12:
						if(count($yz)==3){
						$TemplateString.="document.getElementById(\"FileName_{$f_i}_Msg\").innerHTML={$yz[0]}(document.getElementsByName(\"FileName_{$f_i}\")[0].value,{$yz[1]},{$yz[2]},\"<font color='red'>{$yz_arr[3]}</font>\");\n";
						$TemplateString.="if(document.getElementById(\"FileName_{$f_i}_Msg\").innerHTML.length>0){
					document.getElementsByName(\"FileName_{$f_i}\")[0].select();
					return false;
					}\n";
						}
						
						break;
					case 2:
						if($yz_arr[5]=="isCheck"){
							$TemplateString.="\nif(document.getElementById(\"FileName_{$f_i}\").value==0){
								document.getElementById(\"FileName_{$f_i}\").focus();
								return false;
								}\n";
						}
						break;
					case 3:
						if($yz_arr[5]=="isCheck"){
						$TemplateString.="
						var obj=document.getElementsByName(\"FileName_{$f_i}\");
						if(isCheck(obj)==false){
							document.getElementById(\"FileName_{$f_i}_Msg\").innerHTML=\"<font color='red'>{$yz_arr[3]}</font>\";
							return false;
						}
						";
						}
						break;
					case 4:
						if($yz_arr[5]=="isCheck"){
						$TemplateString.="
						var obj=document.getElementsByName(\"FileName_{$f_i}[]\");
						if(isCheck(obj)==false){
							document.getElementById(\"FileName_{$f_i}_Msg\").innerHTML=\"<font color='red'>{$yz_arr[3]}</font>\";
							return false;
						}
						";
						}
						break;
					case 6:
						if(count($yz)==3){
						$TemplateString.= "document.getElementById(\"FileName_{$f_i}_Msg\").innerHTML={$yz[0]}(document.getElementsByName(\"FileName_{$f_i}\")[0].value,{$yz[1]},{$yz[2]},\"<font color='red'>{$yz_arr[3]}</font>\");\n";
						}else{
						$TemplateString.= "document.getElementById(\"FileName_{$f_i}_Msg\").innerHTML=CharLen(document.getElementsByName(\"FileName_{$f_i}\")[0].value,0,1000,\"<font color='red'>{$yz_arr[3]}</font>\");\n";
						}
						$TemplateString.= "if(document.getElementById(\"FileName_{$f_i}_Msg\").innerHTML.length>0){
					document.getElementsByName(\"FileName_{$f_i}\")[0].select();
					return false;
					}\n";
						break;
				}
					
			}

		}
		
		
		$TemplateString.="\n}\n</script>";
		$TemplateString.=$html->includeend();
		
		$fp=@fopen($writefilepath,"w");
		@fwrite($fp,$TemplateString);
		@fclose($fp);
	}
}


function YKT_Config_FromSort($ListArr,$ShowSortList){
	$S_Arr=explode("|",$ShowSortList);
	for($i=0;$i<count($S_Arr);$i++){
		$r_array[]=$ListArr[$S_Arr[$i]];
	}
	for($j=0;$j<count($ListArr);$j++){
		$jia=0;
		for($x=0;$x<count($S_Arr);$x++){
			if($j==$S_Arr[$x]){
				$jia=1;
				break;
			}
		}
		if($jia==0){
			$r_array[]=$ListArr[$j];
		}
	}
	return $r_array;
}




?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系统管理</title>
<link href="../../Css.css" rel="stylesheet" type="text/css">
</head>

<body style="width:97%">
<script type="text/javascript">
function GetClasslist(divname,selectname,thisvalue)
{
	var tvalue=parseInt(thisvalue)
	var droplist="";
	if(tvalue==2||tvalue==3||tvalue==4)
	{
		droplist="<select name=\""+selectname+"\" id=\""+selectname+"\"><?php $System->MenuClassSyslist() ?></select>";
	}
	document.getElementById(divname).innerHTML=droplist;
}
</script>
<form action="<?php echo $_SERVER['PHP_SELF']?>?MenuID=<?php echo $MenuID?>"  name="editalter" id="editalter" method="post">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" style=" background-color:#FA7F18" class="YKTtable">
  <tr class="YKTtr" Height="25">
    <td width="30" style=" background-color:#BB4A04; color:#FFF;"><div align="center">序号</div></td>
    <td style=" background-color:#BB4A04; color:#FFF;"><div align="center">名称</div></td>
    <td width="79" style=" background-color:#BB4A04; color:#FFF;"><div align="center">输入类型</div></td>
    <td width="50" style=" background-color:#BB4A04; color:#FFF;"><div align="center">关联数据</div></td>
    <td style=" background-color:#BB4A04; color:#FFF;"><div align="center">说明</div></td>
    <td width="70" style=" background-color:#BB4A04; color:#FFF;"><div align="center">字段名</div></td>
    <td width="50" style=" background-color:#BB4A04; color:#FFF;"><div align="center">字段类型</div></td>
    <td width="40" style=" background-color:#BB4A04; color:#FFF;"><div align="center">开/关</div></td>
    <td style=" background-color:#BB4A04; color:#FFF;"><div align="center">数据验证</div></td>
    <td style=" background-color:#BB4A04; color:#FFF;"><div align="center">默认值</div></td>
  </tr>
  <?php
  $formvaluearr=1;
  for($i=0;$i<$fieldscount;$i++)
  {
	 $field_name=mysql_field_name($result,$i);
	 $field_type=mysql_field_type($result,$i);
	 if(isset($getfromconfigarr[$i])){
		$fieldsvaluearr=explode("|",$getfromconfigarr[$i]);
	 }else{
		$fieldsvaluearr=array();	
	 }
  ?>
  <tr>
    <td height="25" class="MenConfig_YKTtr" style="background-color:#FFE4CB"><div align="center"><?php echo $i?></Div></td>
    <td height="25" class="MenConfig_YKTtr" style="background-color:#FFE4CB"><label>
      <div align="center">
        <input type="text" name="Name_<?php echo $i?>" value="<?php echo @$fieldsvaluearr[0]?>"  size="10"/>
      </div>
      </label></td>
    <td height="25" class="MenConfig_YKTtr" style="background-color:#FFE4CB"><label>
      <div align="center">
      <?php
      if($i==0 && $tablename!='classsys'){
	  echo '<font style="color:red">系统自动ID</font>';
	  }elseif($i==1 && $tablename!='classsys'){
		echo '<font style="color:red">系统栏目ID</font>'; 
		echo '<input type="hidden" name="Input_'.$i.'" id="Input_'.$i.'" value="8" />';  
	  }elseif($i==2 && $tablename!='classsys'){
		echo '<font style="color:red">系统静态路径</font>';
	  }elseif($i==3 && $tablename!='classsys'){
		echo '<font style="color:red">移动端静态路径</font>'; 
	  }else{
	  ?>
        <select name="Input_<?php echo $i?>" id="Input_<?php echo $i?>" onChange="GetClasslist('Div_<?php echo $i?>','class<?php echo $i?>',this.value)" >
          <?php
          $System->dropdownlist();
		  ?>
        </select>
        <?php
        if(!empty($fieldsvaluearr[1])){
        	echo "<script type=\"text/javascript\">
        			document.getElementById(\"Input_".$i."\").value=\"".@$fieldsvaluearr[1]."\"
        		  </script>";
        }
	 
	   }
      	?>
      </div>
      </label></td>
    <td height="25" class="MenConfig_YKTtr" style="background-color:#FFE4CB"><div align="center" id="Div_<?php echo $i?>" >

	  </div>
	  <script type="text/javascript">
	  try{
	  GetClasslist('Div_<?php echo $i?>','class<?php echo $i?>',<?php echo @$fieldsvaluearr[1]?>);
	  if(document.getElementById("class<?php echo $i?>")!=null)
	  {
		document.getElementById("class<?php echo $i?>").value="<?php echo @$fieldsvaluearr[2]?>";
	  }
	  }catch(e){}
	  </script>
	  </td>
    <td height="25" class="MenConfig_YKTtr" style="background-color:#FFE4CB"><div align="center">
        <input type="text" name="Mark_<?php echo $i?>"  value="<?php echo @$fieldsvaluearr[3]?>"/>
      </div></td>
    <td height="25" class="MenConfig_YKTtr" style="background-color:#FFE4CB"><div align="center"><?php echo $field_name?></div></td>
    <td height="25" class="MenConfig_YKTtr" style="background-color:#FFE4CB"><div align="center"><?php echo $System->getfieldtype($field_type)?>[<?php echo $field_type?>]</div></td>
    <td height="25" class="MenConfig_YKTtr" style="background-color:#FFE4CB"><div align="center">
    	
        <?php
        if($i==0 && $tablename!='classsys'){
		  	echo '<font style="color:red">开</font>';
			echo '<input type="hidden" name="Show_'.$i.'" id="Show_'.$i.'" value="0" />';
		}elseif($i==1 && $tablename!='classsys'){
			echo '<font style="color:red">开</font>'; 
			echo '<input type="hidden" name="Show_'.$i.'" id="Show_'.$i.'" value="0" />';  
		}elseif($i==2 && $tablename!='classsys'){
			echo '<font style="color:red">开</font>'; 
			echo '<input type="hidden" name="Show_'.$i.'" id="Show_'.$i.'" value="0" />';
		}elseif($i==3 && $tablename!='classsys'){
			echo '<font style="color:red">开</font>'; 
			echo '<input type="hidden" name="Show_'.$i.'" id="Show_'.$i.'" value="0" />'; 
		}else{
			?>
		
			<select  name="Show_<?php echo $i?>" id='Show_<?php echo $i?>'>
			  <option value="1" selected="selected">关</option>
			  <option value="0" >开</option>
			</select>
		  <script type="text/javascript">
			<?php
			
			 if(!isset($fieldsvaluearr[4]) || $fieldsvaluearr[4]=='1'){
				$fieldsvaluearr[4]='1';
			 }else{
				$fieldsvaluearr[4]='0';
			 }
			?>
			try{
			document.getElementById("Show_<?php echo $i?>").value="<?php echo $fieldsvaluearr[4]?>";
			}catch(e){}
			<?php
		}
		?>
        </script>
      </div></td>
    <td height="25" class="MenConfig_YKTtr" style="background-color:#FFE4CB"><div align="center">
        <input type="text" name="Check_<?php echo $i?>"  value="<?php echo @$fieldsvaluearr[5]?>" size="20"/>
      </div></td>
     <td height="25" class="MenConfig_YKTtr" style="background-color:#FFE4CB"><div align="center">
        <input type="text" name="Defaultvalue_<?php echo $i?>"  value="<?php echo @$fieldsvaluearr[6]?>" size="10"/>
      </div></td>
  </tr>
  <?php
  }
  ?>
<input type="hidden" name="FieldCount"  value="<?php echo $fieldscount?>"/>
</table>
<table width="100%" border="0" align="center" cellpadding="0" style=" background-color:#FA7F18" cellspacing="1" class="YKTtable">
  <tr>
    <td width="15%" height="30" class="MenConfig_YKTtr" style="background-color:#FFE4CB"><div align="right">显示的字段列表:</div></td>
    <td height="30" colspan="2" align="left" class="MenConfig_YKTtr" style="text-align:left;background-color:#FFE4CB"><input name="FieldList" type="text" id="FieldList" size="50" value="<?php echo $getfromconfigliststringarr[0]?>">
     形式 字段1/宽度/对齐方式|字段n/宽度/对齐方式       </td>
  </tr>
  <tr>
    <td height="30" class="MenConfig_YKTtr" style="background-color:#FFE4CB"><div align="right">功能列表:</div></td>
    <td width="50%" height="30" align="left" class="MenConfig_YKTtr" style="text-align:left;background-color:#FFE4CB">
       <?php
      $checkboxlistarr=explode("|",$getfromconfigliststringarr[1]);
      $checkstring=array("添加","修改","删除","批量删除","审核","翻页");
      for($j=0;$j<count($checkboxlistarr);$j++){
      	if(strval($checkboxlistarr[$j])=="1"){
      		$checked=" checked=\"checked\" ";
      	}else{
      		$checked="";
      	}
      	echo "<label><input type=\"checkbox\" name=\"checkbox".($j+1)."\" id=\"checkbox".($j+1)."\" value=\"1\"  {$checked} />{$checkstring[$j]}</label>&nbsp;&nbsp;&nbsp;";
      }
    ?></td>
    <td width="30%" height="30" align="left" class="MenConfig_YKTtr" style="text-align:left;background-color:#FFE4CB"><label>
      <input name="PageSize" type="text" id="PageSize" size="6" value="<?php echo $getfromconfigliststringarr[2]?>">
      </label>
      条／页 *每页显示的记录条数 </td>
  </tr>
  <tr>
    <td height="30" class="MenConfig_YKTtr" style="background-color:#FFE4CB"><div align="right">优先显示的详细字段:</div></td>
    <td height="30" align="left" class="MenConfig_YKTtr" style="text-align:left;background-color:#FFE4CB"><input name="myconfig" type="text" size="50" value="<?php echo $getfromconfigliststringarr[3]?>" />1|2|4</td>
    <td height="30" align="left" class="MenConfig_YKTtr" style="text-align:left;background-color:#FFE4CB"><input name="Outmyconfig" type="text" size="20" value="<?php echo $getfromconfigliststringarr[4]?>" />前台屏蔽字段 1|2|4</td>
  </tr>
  <tr>
    <td height="30" class="MenConfig_YKTtr" style="background-color:#FFE4CB;"><div align="right">搜索字段:</div></td>
    <td height="30" colspan="1" align="left" class="MenConfig_YKTtr" style="text-align:left;background-color:#FFE4CB"><input name="mySearch" type="text" id="mySearch" value="<?php echo $getfromconfigliststringarr[5]?>" size="50" /><a href="#3">?</a></td><td height="30" colspan="1" align="left" class="MenConfig_YKTtr" style="text-align:left;background-color:#FFE4CB"><input name="myClassLev" type="text" id="myClassLev" value="<?php echo $getfromconfigliststringarr[6]?>" size="4" />分级允许级数</td>
  </tr>
  <tr>
    <td height="30" class="MenConfig_YKTtr" style="background-color:#FFE4CB;"><div align="right">在各页面显示的标题:</div></td>
    <td height="30" colspan="2" align="left" class="MenConfig_YKTtr" style="text-align:left;background-color:#FFE4CB"><input name="InfoTitle" type="text" id="InfoTitle" size="50"  value="<?php echo $getfromconfigliststringarr[7]?>">
      <label>
      <input name="MenuShow"  checked="checked"  type="radio" value="0">
      在栏目中显示
      <input name="MenuShow"   type="radio" value="1">
      不在栏目中显示&nbsp;&nbsp; </label>
      <script type="text/javascript">
for(var Js_MenuShow=0;Js_MenuShow<document.getElementsByName("MenuShow").length;Js_MenuShow++){
	if(document.getElementsByName("MenuShow").item(Js_MenuShow).value=="<?php echo $getfromconfigmenushow?>"){
		document.getElementsByName("MenuShow").item(Js_MenuShow).checked=true;
	}
}</script>
      <a href="sys_superadd.php?MenuID=<?php echo $MenuID?>" target="_self"  class="Link12"><font color="#FF0000">批量添加信息</font></a>&nbsp;&nbsp;</td>
  </tr>
  <tr>
    <td height="30" colspan="3" style="background-color:#FFE4CB; height:40px;"><div align="center">
  <label>
  <input type="submit" name="Submit" value=" 保存 " />
  <input type="button" name="Submit2" value="取消" onClick="javascript:window.history.back();"/>
  </label>
</div></td>
  </tr>
</table>


</form>
<br /><br />
<div  align="center" class="YKTth" id="DataEdit" style="vertical-align:middle;height:24px; padding:0px; background-color:#BB4A04; color:#FFF; line-height:24px; border:1px solid #FA7F18; cursor:hand;" onClick="divdisp('addalter')">数据表结构管理</div>
<div id="addalter"  style="display:none; padding:0px;">
  <table height="39" border="0" width="100%" style=" margin:0px; padding:0px;" align="left" cellpadding="0" cellspacing="1" bgcolor="#BB4A04">
   <form action="alter.php?act=add" method="post" id="alter" name="alter">
    <tr>
      <td align="center" bgcolor="#FFFFFF" class="sundog">添加字段</td>
      <td height="12" align="center" bgcolor="#FFFFFF" class="sundog">类型</td>
      <td height="12" align="center" bgcolor="#FFFFFF" class="sundog">设定大小</td>
      <td height="12" align="center" bgcolor="#FFFFFF" class="sundog">允许空值</td>
      <td height="12" align="center" bgcolor="#FFFFFF" class="sundog">默认值</td>
      <td height="12" align="center" bgcolor="#FFFFFF" class="sundog">&nbsp;&nbsp;</td>
    </tr>
    <tr>
      <td align="center" bgcolor="#FFFFFF" class="sundog"> <?php echo $tablename.$fieldscount?>      </td>
      <td height="23" align="center" bgcolor="#FFFFFF" class="sundog">
          <select size="1" id="fieldtype" name="fieldtype">
          <option value=""></option>
		  <option value="int">整数</option>
		  <option value="varchar">字符</option>
		  <option value="date">时间</option>
          <option value="enum">布尔</option>
          <option value="float">浮点</option>
		  <option value="text">备注</option>
        </select>
       </td>
      <td height="23" align="center" bgcolor="#FFFFFF" class="sundog">
          <input type="text" id="fieldsize" name="fieldsize" size="10">
      </td>
      <td height="23" align="center" bgcolor="#FFFFFF" class="sundog">
          <input type="checkbox" name="filednull" onclick="c_filednull()" id="filednull" value="no">
      </td>
      <td height="23" align="center" bgcolor="#FFFFFF" class="sundog">
          <input type="text" id="fielddefault" name="fielddefault" size="10">
          <input name="MenuID" type="hidden" id="MenuID" value="<?php echo $MenuID?>">
      </td>
      <td height="23" align="center" bgcolor="#FFFFFF" class="sundog">
          <input name="fieldtable" type="hidden" id="fieldtable" value="<?php echo $tablename?>">
          <input name="fieldtablename" type="hidden" id="fieldtablename" value="<?php echo $tablename.$fieldscount?>">
          <input type="submit" value="添加">
          <input name="" type="button" onClick="divdisp('addalter')" value="取消" >
      </td>
    </tr>
    </form>
    
   <form action="alter.php?act=del" method="post" id="alter" name="alter">
   <input name="fieldtablename" type="hidden" id="fieldtablename" value="<?php echo $tablename.($fieldscount-1)?>">
   <input name="fieldtable" type="hidden" id="fieldtable" value="<?php echo $tablename?>">
   <input name="MenuID" type="hidden" id="MenuID" value="<?php echo $MenuID?>">
    <tr>
      <td align="center" colspan="6" bgcolor="#FFFFFF" class="sundog"><input type="submit" onclick="return confirm('你确认要删除最后一个字段吗？\n这可能会影响其它栏目的配置！！')" value=" 删除最后一个字段 " /></td>
      </tr>
      </form>
   </table>
</div>

<br />
<table width="90%" height="132" border="0" align="center" cellpadding="0" cellspacing="0" class="STtable">
  <tr>
    <td align="left" valign="top" class="STtd"><p>1、      数据验证 数据长度函数 CharLen/最小长度/最大长度 　　　　　　 如： CharLen/2/12 <br>
     　　　　　　 数字判断　　　IsNum／最小值／最大值　　　　　　　　 如：　ISNum/0/6000<br>
     　　　　　　 邮件地址　　　IsMail/最小长度/最大长度 　　　　　　 如：　IsMail/10/20<br>
      　　　　　　 日期判断　　　IsDateTime/最小值/最大值 　　　　　　 如：　IsDateTime/1988-10-12/2010-10-20<br>
      　　　　　　 正则判断　　　MyRegExp/正则式/&nbsp;&nbsp;   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 　　　　　 如：　MyRegExp/^(\d){0,6}$/<br>
      　　　　　　 　　正则式例子：<br>
      　　　　　　 　　&nbsp;&nbsp;&nbsp; ①邮件地址:^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+([a-zA-Z]{2}|net|NET|com|COM|gov|GOV|mil|MIL|org|ORG|edu|EDU|int|INT)$<br>
      　　　　　　 　　&nbsp;&nbsp;&nbsp; ②数字:MyRegExp/^[0-9]{1,6}$/(1-6位)<br>
      　　　　　　 　　&nbsp;&nbsp;&nbsp;      ③登录名:MyRegExp/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}$/(只能输入5-20个以字母开头、可带数字、“_”、“.”的字串)<br>
      　　　　　　 　　&nbsp;&nbsp;&nbsp;      ④电话、传真:MyRegExp/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/<br>
      　　　　　　 　　&nbsp;&nbsp;&nbsp;      ⑤手机号码:MyRegExp/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/<br>
      　　　　　　 　　&nbsp;&nbsp;&nbsp;      ⑥邮政编码:MyRegExp/^[a-zA-Z0-9 ]{3,12}$/<br>
        <br>
        复选框、单选框、下拉框在说明栏填写内容后，将为必添项；数据长度、数字判断、日期判断、 邮件地址在说明栏填写内容后，将为必添项。<br>
        2、文件上传　文件大小／文件格式１\文件格式n/保存路经　 如：　800/jpg\jpge\png\bmp\gif/\admin\System\UpFile\</p>
      <p>3<a name="3"></a>、搜索字段 格式：标题/字段序号/搜索类型|标题/字段序号/搜索类型；搜索类型：0 字符串，1 分类，2 日期<br>   
&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如：标题/1/0|分类/5/1|日期/7/2</p>
      </td>
  </tr>
  <tr>
    <td align="left" valign="top" class="STtd">&nbsp;</td>
  </tr>
</table>
<br /><br /><br /><br /><br />
<script type="text/javascript">
function divdisp(divname)
{
	if(document.getElementById(divname).style.display=="")
		document.getElementById(divname).style.display="none";
	else
		document.getElementById(divname).style.display="";
}
function c_filednull()
{
	if(document.getElementById("filednull").checked)
	{
		document.getElementById("fielddefault").style.display="none";
	}
	else
	{
		document.getElementById("fielddefault").style.display="";
	}
}
</script>
</body>
</html>
<?php
//$html->includeend();
?>